<script setup>
// 路由跳转
// vue2  this.$router.push()
// vue3:没有this
/*
  this.$router
     import {useRouter} from 'vue-router'
     this.$router====useRouter()
     const router=useRouter()
     router.push(...)
  this.$route
     import {useRoute} from 'vue-router'
     this.$route====useRoute()
     const route=useRoute()

*/
import { useRouter } from 'vue-router'
const router = useRouter()
const goUser = () => {
  router.push('/user')
}
</script>

<template>
  <div class="page">
    <router-link to="/">首页</router-link>
    <br />
    <router-link to="/user">用户</router-link>
    <br />
    <button @click="goUser">跳转到用户</button>
    <router-view></router-view>
  </div>
</template>

<style scoped></style>
